#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSwitchConditionDao:DaoBase<TableSwitchCondition>
    {
        public override string GetFileName()
        {
            return "TableSwitchCondition.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimary = new Dictionary<string, TableSwitchCondition>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableSwitchCondition model)
        {
            #if UNITY_EDITOR
            if(cachePrimary.ContainsKey(model.switchName)) UnityEngine.Debug.LogError("数据表id重复:TableSwitchCondition->id: " + model.switchName);
            #endif
            cachePrimary[model.switchName] = model;
        }
        protected override TableSwitchCondition ParseRowData(string[] rowData)
        {
            TableSwitchCondition data = new TableSwitchCondition();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.switchName = rowData[0];
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.conditionType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.conditionParam = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.switchChineseName = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.configurable = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.clienTaskName = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.open = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.inPrisonCanPlay = int.Parse(rowData[7]);
            }
            return data;
        }
    }
}
